// ******************************************************************
// * Copyright(c)  Steven Lu
// * Description   : Entity_PUR_RFQ_ITEM
// * CreateDate    : 2014-02-18 18:04:12
// * Creater       : CodeSmith
// * LastChangeDate: 2014-02-18 18:04:12
// * LastChanger   : 2014-02-18 18:04:12
// * Version Info  : 1.0 For ESOL
// ******************************************************************

using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Suzsoft.Smart.Data;
using ESOL.Common.Entity;

namespace ESOL.Business.Pur
{
/// <summary>
    /// PurRfqItem
    /// </summary>
    public partial class PurRfqItemBs
    {
        #region GetByID
        /// <summary>
        /// Get Entity
        /// </summary>
        /// <param name="objPurRfqItemEntity">Entity</param>
        /// <returns>Entity</returns>
        public static PurRfqItemEntity GetPurRfqItem(PurRfqItemEntity objPurRfqItemEntity)
        {
            return DataAccess.SelectSingle<PurRfqItemEntity>(objPurRfqItemEntity);
        }
        #endregion


        #region Insert
        /// <summary>
        /// Insert Data
        /// </summary>
        /// <param name="objPurRfqItemEntity">Entity</param>
        /// <returns>true Insert Succeed; false Insert Fail</returns>
        public static bool InsertPurRfqItem(PurRfqItemEntity objPurRfqItemEntity)
        {
            return DataAccess.Insert(objPurRfqItemEntity);
        }

        public static bool InsertPurRfqItem(List<PurRfqItemEntity> objPurRfqItemEntityList)
        {
            return DataAccess.Insert(objPurRfqItemEntityList);
        }
        #endregion


        #region Update
        /// <summary>
        /// Update Data
        /// </summary>
        /// <param name="objPurRfqItemEntity">Entity</param>
        /// <returns>true Update Succeed; false Update Fail</returns>
        public static bool UpdatePurRfqItem(PurRfqItemEntity objPurRfqItemEntity)
        {
            return DataAccess.Update(objPurRfqItemEntity);
        }

        public static bool UpdatePurRfqItem(List<PurRfqItemEntity> objPurRfqItemEntityList)
        {
            return DataAccess.Update<PurRfqItemEntity>(objPurRfqItemEntityList);
        }
        #endregion


        #region Delete
        /// <summary>
        /// Delete Data
        /// </summary>
        /// <param name="objPurRfqItemEntity">Entity</param>
        /// <returns>true Delete Succeed; false Delete Fail</returns>
        public static bool DeletePurRfqItem(PurRfqItemEntity objPurRfqItemEntity)
        {
            return DataAccess.Delete(objPurRfqItemEntity);
        }

        public static bool DeletePurRfqItem(List<PurRfqItemEntity> objPurRfqItemEntityList)
        {
            return DataAccess.Delete<PurRfqItemEntity>(objPurRfqItemEntityList);
        }

        public static bool DeletePurRfqItem(PurRfqItemEntity objPurRfqItemEntity,List<PurRlAppiRfqiEntity> rels)
        {
            using (DataAccessBroker broker = DataAccessFactory.Instance())
            {
                try
                {
                    broker.BeginTransaction();
                    if (rels != null)
                    {
                        DataAccess.Delete(rels, broker);
                    }
                    DataAccess.Delete(objPurRfqItemEntity, broker);
                    broker.Commit();
                    return true;
                }
                catch (Exception ex)
                {
                    broker.RollBack();
                    return false;
                }
            }
        }
        #endregion


        #region GetAll
        /// <summary>
        /// Get All Data
        /// </summary>
        /// <returns>Back All Data<returns>
        public static DataSet GetPurRfqItemAll()
        {
            return DataAccess.SelectAllDataSet<PurRfqItemEntity>();
        }
        /// <summary>
        /// Get All Data List
        /// </summary>
        /// <returns>Back All Data List<returns>
        public static List<PurRfqItemEntity> GetPurRfqItemAllList()
        {
            return DataAccess.SelectAll<PurRfqItemEntity>();
        }
        #endregion

        public static List<PurRfqItemEntity> GetRfqItemAllListByRfqNo(string rfqNo)
        {
            if (string.IsNullOrEmpty(rfqNo))
                return null;
            return DataAccess.Select<PurRfqItemEntity>(new PurRfqItemEntity { RfqNo = rfqNo });
        }

	}
	
	
}	

